{include file="public/header" select="0" /}

<body>
<div class="title bgc">
    <i class="layui-icon layui-icon-left" onclick="goBack()"></i>
    转账
</div>
<form action="{:url('transfer/save')}" method="post" class="form layui-form">
    <ul class="set-form bgc">
        <li>
            <span>转账账户</span>
            <div class="layui-form">
                <select name="account">
                    <option value="bonus">奖金(余额:{$user.assets.bonus})</option>
                    <option value="currency">电子币(余额:{$user.assets.currency})</option>
                </select>
            </div>
        </li>
        <li>
            <span>收账会员</span>
            <label>
                <input type="text" lay-verify="required" lay-reqtext="请填写收账会员编号" lay-verType="tips"
                       name="take" id="take" placeholder="请填写收账会员编号" autocomplete="off">
            </label>
        </li>
        <li class="take_info" style="display: none;">
            <span>收账会员姓名</span>
            <a href="javascript:;" class="take_nickname"></a>
        </li>
        <li>
            <span>转账金额</span>
            <label>
                <input type="text" lay-verify="required" lay-reqtext="请填写转账金额" lay-verType="tips"
                       name="amount" placeholder="请填写转账金额"
                       onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" autocomplete="off">
            </label>
        </li>
        <li>
            <span>支付密码</span>
            <label><input type="password" lay-verify="required" lay-reqtext="请输入支付密码" lay-verType="tips"
                          name="pay_password" placeholder="请输入支付密码"></label>
        </li>
    </ul>
    <div class="pay-btn" lay-submit lay-filter="save" formObj=".form"><a>确定</a></div>
</form>
<div class="pay-btn tran-btn"><a href="{:url('transfer/record')}">转账记录</a></div>
</body>
{include file="public/footer" select="0" /}
<script>
    $('#take').blur(function () {
        var value = $(this).val();
        if (value) {
            $.ajax({
                type: 'GET',
                url: '{:url("transfer/verify")}',
                data: {code:value},
                dataType: "json",
                success: function (data) {
                    if(data.code === 1){
                        $(".take_nickname").text(data.result).css('color','#008200');
                    }else{
                        $(".take_nickname").text(data.result).css('color','red');
                    }
                    $(".take_info").show();
                }
            });
        }else{
            $(".take_info").hide();
        }
    });
</script>